package com.example.crm.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.crm.entity.Product;
import com.example.crm.entity.Shop;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ProductMapper extends BaseMapper<Product> {

    @Select("SELECT p.id,p.product_code,p.product_name,p.product_price,p.product_amount,p.product_classify,s.shop_name as product_shop from product p LEFT JOIN shop s on p.product_shop = s.id")
    List<Product> selectProductWithShopName();
}
